The present invention relates generally to source code generation, and more particularly to source code generation using extracted templates.
Code generation technology is commonly used to reduce the workload of project construction. Usually, the template files are extracted by experienced developers through manual review of earlier projects. However, as the technology and programming language is quickly evolving, it is challenging to build and maintain the template files with best practices for code generation. It is difficult to determine where to draw the line between a template and other reusable artifacts. It is also difficult to identify (or calculate), exact and reuse a template effectively. Further, it is challenging and to improve and evolve the template when development projects are ongoing.
Code generation software, such as the CodeSmith Generator, is a development tool that generates code based on existing templates or pre-defined configuration files in order to extract templates. CodeSmith Generator essentially is a template-driven source code generator that automates the creation of common application source code for any language. However, code generation software has significant drawbacks. Code generation software requires the template to be written manually. In addition, the template is generated for complete classes and for a piece of code to implement a specific function.
Some code generation software generates programming code based on created business classes and a selected template, but the template solutions are pre-defined. Other code generation software requires user input for code configuration information, loads pre-defined template files, and then fills the template to generate different type codes. However, in all of the above referenced code generation software, the template is pre-defined, i.e. created by the user, and not adaptable or reusable for several projects.
Therefore, there is a need for an evolving system and method of template extraction where templates are generated automatically and generated for a whole project, or several projects.